%run CPA routine
testCase();%the first assignment
P = V(:,end:-1:end-9);
b = lambda(end:-1:end-9);

%test shape cc1
I = imread('./cc-images/cc0flip.png');

T = [130 150]';%cc0
s = 205;
degree = -6
DmMax = 3;
MODE = 1;
searchLen = 1;
ASM(I, estShape, T, s, degree, DmMax, searchLen, MODE, P, b);

%/////////////////////////////////////////////////////////////
T = [123 130]';
s = 215;
degree = -19;
DmMax = 3;
MODE = 1;
searchLen = 0.5
I = imread('./cc-images/cc1.png');
%%%%%%%%%%%
% I = double(I)/255.0;
% [I Idx Idy] = gaussgradient(I, 2); 
% I = sqrt(Idx.^2+Idy.^2);
% I = I./max(max(I));
% imshow(I);
% [ShapeX R] = rePositionShape(estShape,s, degree, T);
% drawSingleShape(ShapeX, 'r');
%%%%%%%%%%
ASM(I, estShape, T, s, degree, DmMax, searchLen, MODE, P, b);

%/////////////////////////////////////////////////////////////
T = [125 120]';
s = 200;
degree = 0;
DmMax = 5;
MODE = 1;
searchLen =3;
I = imread('./cc-images/cc2.png');
%%%%%%%%%%%
% imshow(I);
% [ShapeX R] = rePositionShape(estShape,s, degree, T);
% drawSingleShape(ShapeX, 'r');
%%%%%%%%%%
ASM(I, estShape, T, s, degree, DmMax, searchLen, MODE, P, b);

T = [138 120]';
s = 200;
degree = -5;
DmMax = 2;
MODE = 1;
searchLen = 3;
I = imread('./cc-images/cc2flip.png');
%%%%%%%%%%%
% I = double(I)/255.0;
% [I Idx Idy] = gaussgradient(I, 2); 
% I = sqrt(Idx.^2+Idy.^2);
% I = I./max(max(I));
% imshow(I);
% [ShapeX R] = rePositionShape(estShape,s, degree, T);
% drawSingleShape(ShapeX, 'r');
%%%%%%%%%%
ASM(I, estShape, T, s, degree, DmMax, searchLen, MODE, P, b);

%/////////////////////////////////////////////////////////////
T = [142 128]';
s = 195;
degree = -2;
DmMax = 2;
MODE = 1;
searchLen = 1;
I = imread('./cc-images/cc3flip.png');
%%%%%%%%%%%
% I = double(I)/255.0;
% [I Idx Idy] = gaussgradient(I, 2); 
% I = sqrt(Idx.^2+Idy.^2);
% I = I./max(max(I));
% imshow(I);
% [ShapeX R] = rePositionShape(estShape,s, degree, T);
% drawSingleShape(ShapeX, 'r');
%%%%%%%%%%
ASM(I, estShape, T, s, degree, DmMax, searchLen, MODE, P, b);

%/////////////////////////////////////////////////////////////
T = [157 112]';
s = 195;
degree = 11;
DmMax = 2;
MODE = 1;
searchLen = 3;
I = imread('./cc-images/cc4flip.png');
%%%%%%%%%%%
% I = double(I)/255.0;
% [I Idx Idy] = gaussgradient(I, 2); 
% I = sqrt(Idx.^2+Idy.^2);
% I = I./max(max(I));
% imshow(I);
% [ShapeX R] = rePositionShape(estShape,s, degree, T);
% drawSingleShape(ShapeX, 'r');
%%%%%%%%%%
ASM(I, estShape, T, s, degree, DmMax, searchLen, MODE, P, b);

%/////////////////////////////////////////////////////////////


